package com.kfm.am.object;

import java.io.*;

public class PersonDemo {

    public static void main(String[] args) {
        try (ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("io\\person.txt"))) {
//            Person person = new Person("张三", 33, 45.5);
//            out.writeObject(person);
        } catch (IOException e) {
            System.out.println(e.getMessage());
        }
    }
}

class PersonTest {

    public static void main(String[] args) {
        try (ObjectInputStream in = new ObjectInputStream(new FileInputStream("io\\person.txt"));) {
            Object object = in.readObject();
            System.out.println(object);
        } catch (IOException | ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
}
